package com.sh.dc.common.enums;

public enum TaskStatusEnum {
    QUEUING("queuing", "排队中"),
    RUNNING("running", "运行中"),
    SUCCESS("success", "已完成"),
    TERMINATED("terminated", "已终止"),
    FAILED("failed", "失败");

    private String code;
    private String name;

    TaskStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }
    public String getName(){
        return name;
    }

    public static String getNameByCode(String code) {
        for (TaskStatusEnum taskStatusEnum : TaskStatusEnum.values()) {
            if (taskStatusEnum.code.equals(code)) {
                return taskStatusEnum.getName();
            }
        }
        return null;
    }

}
